#include"comm.h"
int main()
{
   int fd = open(MYFIFO,O_WRONLY);
   if(fd < 0)
   {
    perror("client open");
    exit(1);
   }
   //从键盘中读取数据，然后写入到管道当中,由server进行读取
   while(1)
   {
        printf("please enter message: ");
        fflush(stdout);
        char buffer[1024] = {0};
        ssize_t n = read(0,buffer,sizeof(buffer)-1);//从标准输入当中读数据
        if(n > 0)  //实际读取的内容：hello\n  n=6
        {
            buffer[n-1] = '\0';//把\n覆盖掉
            write(fd,buffer,strlen(buffer)); //注意：不写入\0
        }
   }
   close(fd);
   return 0;
}